// 当前模块：API统一管理
import requests  from "./request";
import mocklRequest from "./mockRequest";

// 三级联动接口 http://39.98.123.211
// /api/product/getBaseCategoryList
// 返回值为Promise对象
export const reqCategoryList = () => requests({url: '/product/getBaseCategoryList', method: 'get'})
// 获取数据 mock banners
export const reqGetBannersList = () => mocklRequest({url: '/banners', method: 'get'})
// 获取 mock floor
export const reqGetFloorsList = () => mocklRequest({url:'/floors', method: 'get'})
// 获取 search 数据 post数据 发送请求至少带个 空对象
export const reqGetSearchList = (params) => requests.post('/list', params)
// 获取商品页 详情  /api/item/{ skuId }
export const reqGoodsInfo = (skuId) => requests.get(`item/${skuId}`)
// 将商品发给服务器/api/cart/addToCart/{ skuId }/{ skuNum }
export const reqAddOrUpdateShopCart = (skuId, skuNum) => requests.post(`/cart/addToCart/${skuId}/${skuNum}`)
// 获取购物车列表 /api/cart/cartList
export const reqShopCartList = () => requests.get('/cart/cartList')
// 删除购物车请求 /api/cart/deleteCart/{skuId}
export const reqDeleteCartList = (skuId) => requests({url:`/cart/deleteCart/${skuId}`, method: 'delete'})
// 修改商品改变状态 /api/cart/checkCart/{skuID}/{isChecked}
export const reqUpdateCheckedByid = (skuId, isChecked) => requests({url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get'})
// 获取验证码 /api/user/passport/sendCode/{phone}  /api/user/passport/sendCode/{phone}
export const reqGetCode =  (phone) => requests.get(`/user/passport/sendCode/${phone}`)
// 注册用户 /api/user/passport/register  post
export const reqUserRegister = (data) => requests.post('/user/passport/register', data)
// 用户登陆  /api/user/passport/login post 
export const reqUserLogin = (data) => requests.post('/user/passport/login', data)
// 获取用户信息 /api/user/passport/auth/getUserInfo get
export const reqUserInfo = () => requests.get('/user/passport/auth/getUserInfo')
// 退出登录 /api/user/passport/logout
export const reqLoginOut = () => requests.get('/user/passport/logout')
// 获取地址   /api/user/userAddress/auth/findUserAddressList
export const reqAddressList = () => requests.get('user/userAddress/auth/findUserAddressList')
// 获取交易商品/api/order/auth/trade  get
export const reqShopOrderList = () => requests.get('/order/auth/trade')
// 提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo}   post
export const reqSubOrder = (tradeNo, data) => requests.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, data)
// 获取订单信息 /api/payment/weixin/createNative/{orderId} get
export const reqPayInfo = (orderId) => requests.get(`/payment/weixin/createNative/${orderId}`)
// 查询支付状态 /api/payment/weixin/queryPayStatus/{orderId} 
export const reqGetInfo = (orderId)=> requests.get(`/payment/weixin/queryPayStatus/${orderId}`)
// 获取订单状态 /api/order/auth/{page}/{limit} get
export const reqOrderList = (page, limit) => requests.get(`/order/auth/${page}/${limit}`)